function test9( )
%TEST4 Summary of this function goes here
%   Detailed explanation goes here
    
    
    W = imread('../TestImg/m.jpg');
    W = double(W(:,:,1));
%     S = [2,4;6,8];
%     W = zeros(40,40);
%     for i = 1:40
%         for j = 1:2:40
%             W(i,j)=1;
%         end
%     end

    S = fspecial('motion',20,45);

    H = conv2(W,S)./sum(S(:));
     
    t = cputime;
    WRec = MyDeconv2DFast(H,S,size(W,1),size(W,2),1,0).*sum(S(:));
    disp(cputime-t);
    
    
    figure(1); 
    subplot(2,2,1);
    imshow(ZeroToOne(W));
    disp('W');
    %disp(W);
    
    subplot(2,2,2);
    imshow(ZeroToOne(S));
    disp('S');
    %disp(S);
    
    subplot(2,2,3);
    imshow(ZeroToOne(H));
    disp('H');
%     disp(H);
    
    subplot(2,2,4);
    imshow(ZeroToOne(WRec));
    disp('WRec');
%     disp(WRec);
    
end


function y = NewFullSize(H, m, n)
    [mh,nh] = size(H);
    y = zeros(mh+m-1, nh+n-1);            
    m = ceil(m/2);
    n = ceil(n/2);
    
    y(m:(m+mh-1), n:(n+nh-1) ) = H;
    
    
    maxY = max(H(:));
    
    for i = 1:size(y,1)
        y(i,1:(n+n)) = y(i,n+n);
        y(i, (n+nh-n-1):size(y,2)) = y(i,(n+nh)-1-n);
%         y(i,1:(n+n)) = maxY;
%         y(i, (n+nh-n-1):size(y,2)) = maxY;
    end
    
    for j = 1:size(y,2)
        y(1:(m+m), j) = y(m+m,j);
        y((m+mh-m):size(y,1), j) = y((m+mh-1-m),j);
%         y(1:(m+m), j) = maxY;
%         y((m+mh-m):size(y,1), j) = maxY;
    end
end


